<include file="Public/header"/>

<link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap-datetimepicker.min.css">
<include file="Public/menu"/>
<!--<script src="__PUBLIC__/js/bootstrap-datepicker.js"></script>-->
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            {$title}
            <small>{$title_two}</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> {$title}</a></li>
            <li class="active">{$title_two}</li>
        </ol>
    </section>
    <!-- 内容 -->
    <section class="content">

        <div class="tab-content">
            <div class="tab-pane active" id="tab_0">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title"></h3>
                        <div class="form-inline pull-right">
                            <form action="{:U('Letter/index')}" method="get" pjax-container="">
                                <fieldset>
                                    <div class="input-group input-group-sm" style="margin-right: 20px">
                                        <span class="input-group-addon"><strong>类型</strong>
                                        </span>
                                        <select name="letter_type" class="form-control">
                                            <option value="0" >-请选择-</option>
                                            <foreach name="type_data" item="v1" key="k1" >
                                                <option value="{$lk}" <if condition="$letter_type eq $k1 "> selected = "selected"</if>>{$v1}</option>
                                            </foreach>
                                        </select>
                                    </div>

                                    <div class="input-group input-group-sm">
                                        <div class="input-group-btn">
                                            <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i>
                                            </button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>

                         <div class="btn-group pull-right" style="margin-right: 10px">
                             <a href="{:U('Letter/newLetter')}" class="btn btn-sm btn-success"><i
                                     class="fa fa-save"></i>&nbsp;&nbsp;新增短信模板</a>
                         </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tbody>
                            <tr>
                                <th><input type="checkbox" class="grid-select-all"></th>
                                <th>ID<a id="a_order" rank='{$rank}' onclick="rankId('id','{$rank}')" class="fa fa-fw fa-sort" href="javascript:void(0);"></a>
                                </th>
                                <th>类型</th>
                                <th>短信内容</th>
                                <th>发布时间</th>
                                <th>操作</th>
                            </tr>
                            <foreach name="list" item="vo" >
                                <tr>
                                    <td><input type="checkbox" class="grid-item" data-id="{$vo.sl_id}"></td>
                                    <td>{$vo.sl_id}</td>
                                    <td>{$vo.type_name}</td>
                                    <td>{$vo.content}</td>
                                    <td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
                                    <td>
                                        <a href="{:U('Letter/saveLetter',['id'=>$vo[sl_id]])}" class="btn btn-sm btn-primary grid-refreshe">编辑</a>&nbsp;&nbsp;
                                        <a href="{:U('Letter/saveMember',['id'=>$vo[sl_id]])}" class="btn btn-sm btn-primary grid-refreshe">删除</a>&nbsp;&nbsp;
                                        <!-- <if condition="($vo['status'] eq 2)">
                                            <a href="javascript:void(0)" onclick="freezeMember('{$vo[sl_id]}','{$vo[slt_id]}','{$vo[status]}')" class="btn btn-sm btn-primary grid-refreshe">启用</a>&nbsp;&nbsp;
                                             <else />
                                             <a href="javascript:void(0)" onclick="freezeMember('{$vo[sl_id]}','{$vo[slt_id]}','{$vo[status]}')" class="btn btn-sm btn-primary grid-refreshe">禁用</a>&nbsp;&nbsp;
                                         </if>-->
                                    </td>
                                </tr>
                            </foreach>

                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <!--<input type="checkbox" class="grid-select-all">&nbsp;&nbsp;&nbsp;
                        <a class="btn btn-sm btn-danger batch-delete">Batch delete</a>-->
                        {$page}
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>
    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer"/>


<script type="text/javascript" src="/Public/admin/calendar/calendar.js"></script>
<link rel="stylesheet" type="text/css" href="/Public/admin/calendar/calendar-blue.css"/>
<script>

    var rankId = function(ran,order){
        window.location.href="{:U('Letter/index')}"+"?letter_type={$letter_type}&"+ran+"="+order;
    }
    //冻结（解冻）
    //禁用（启用）
    var freezeMember = function(sl_id,slt_id,stat){
        if( (stat == 2 ) ? confirm('您确定要启用？') : confirm('您确定要禁用？') ){
            $.post("{:U('Letter/freezeTemplate')}", { "sl_id": sl_id,"slt_id": slt_id,"status": stat },
                    function(data){
                        alert(data.msg);
                        if(data.stat){
                            window.location.reload();
                        }
                    }, "json");
        }
    }
    //时间控件
   /* date = new Date();
    Calendar.setup({
        inputField: "posttime",
        ifFormat: "%Y-%m-%d",
        showsTime: true,
        timeFormat: "24"
    });
    Calendar.setup({
        inputField: "business_endtime",
        ifFormat: "%Y-%m-%d",
        showsTime: true,
        timeFormat: "24"
    });*/

</script>

